package t20211225;

import java.util.*;

/**
 * @Author: DengJia
 * @Date: 2021/12/25 9:33
 * @Description:
 */

public class AsListInterface {
    public static void main(String[] args) {
        List<Snow> snow1 = Arrays.asList(
                new Crusty(), new Slush(), new Powder()
        );

        List<Snow> snow2 = Arrays.asList(
                new Light(), new Crusty()
        );

        List<Snow> snow3 = new ArrayList<>();
        Collections.addAll(snow3, new Light(), new Heavy());
        // <Snow>为：显示类型参数（Explicit type arguments）
        List<Snow> snow4 = Arrays.<Snow>asList(
                new Light(), new Heavy()
        );

        Set<Object> hs = new HashSet<>(); // 无序
        Set<Object> lhs = new LinkedHashSet<>(); // 按顺序
        Set<Object> ts = new TreeSet<>(); // 可排序
        Map<Object, Object> hm = new HashMap<>(); // 无序
        Map<Object, Object> lhm = new LinkedHashMap<>(); // 按顺序
        Map<Object, Object> tm = new TreeMap<>(); // 可排序

        hs.add("dog");
        hs.add("cat");
        hs.add("rat");

        lhs.add("dog");
        lhs.add("cat");
        lhs.add("rat");

        ts.add("dog");
        ts.add("cat");
        ts.add("rat");

        hm.put(2, "cat");
        hm.put(1, "dog");
        hm.put(3, "rat");

        lhm.put(2, "cat");
        lhm.put(1, "dog");
        lhm.put(3, "rat");

        tm.put(1, "dog");
        tm.put(2, "cat");
        tm.put(3, "rat");

        System.out.println(hs);
        System.out.println(lhs);
        System.out.println(ts);
        System.out.println(hm);
        System.out.println(lhm);
        System.out.println(tm);
    }
}
